package com.chezhujie.www.core.shiro;

import com.chezhujie.www.domain.XyMenu;
import com.chezhujie.www.service.XyMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by 汤伟杰 on 2017/6/19.
 */
@Component
public class MethodToStaticCache {
    @Autowired
    private XyMenuService xyMenuService;

    public void addCache() {
        try {
            List<XyMenu> xyMenuList = xyMenuService.getAllList();
            MenuCache.setMenu_cache(xyMenuList);
            MenuCache.setMenuBeanById_cache(xyMenuList);
            MenuCache.setMenuBeanByNameEn_cache(xyMenuList);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
